#include<bits/stdc++.h>
using namespace std;
#define N 100010
#define M 500050
typedef long long LL;
struct edge{
    int to, nxt;
}e[M << 1];
int head[N], dfn[N], low[N], sz[N], cut[N];
LL ans[N];
int n, m, len, root, num;

void add_edge(int u, int v){
    e[++len].to = v; e[len].nxt = head[u]; head[u] = len; return ;
}

void init(){
    len = 0;
    scanf("%d%d", &n, &m);
    for(int i = 1; i <= m; i++){
        int u, v;
        scanf("%d%d", &u, &v);
        add_edge(u, v); add_edge(v, u);
    }
    return ;
}

void dfs(int cur){
    dfn[cur] = low[cur] = ++num;
    sz[cur] = 1;
    int cnt = 0, sum = 0;
    for(int i = head[cur]; i; i = e[i].nxt){
        int to = e[i].to;
        if(!dfn[to]){
            dfs(to);
            low[cur] = min(low[cur], low[to]);
            sz[cur] += sz[to];
            if(low[to] >= dfn[cur]){
                ++cnt;
                ans[cur] += (LL)sz[to] * (n - sz[to]);
                sum += sz[to];
                if(cur != root || cnt > 1) cut[cur] = 1;
            }
            
        }
        else {
            low[cur] = min(low[cur], dfn[to]);
        }
    }
    if(cut[cur]){
        ans[cur] += (n - 1) + (LL)(n - 1 - sum) * (sum + 1);
    }
    else ans[cur] = (n - 1) * 2;
    return ;
}

void solve(){
    num = 0;
    root = 1;
    dfs(root);
    for(int i = 1; i <= n; i++){
        printf("%lld\n", ans[i]);
    }
    return ;
}

int main(){
    init();
    solve();
    return 0;
}